package biz

import (
	"fmt"
	"log"
	"net/http"
	"order-srv/internal/biz/controller"
	"order-srv/libs"
)

func Server() *http.Server {
	addr := fmt.Sprintf("%s:%d", "0.0.0.0", libs.AppConfig.BizPort)
	log.Printf("api server listening at %v", addr)
	return &http.Server{
		Addr:    addr,
		Handler: controller.SetUp(),
	}
}

func Run() error {
	srv := Server()
	return srv.ListenAndServe()
}
